﻿@using Kendo.Mvc.UI;
@{
    if (!Request.IsAjaxRequest())
    { Layout = "../Shared/_Layout.cshtml"; }
    else
    { Layout = null; }
}
@model TS2015.Models.TbThiSinh

<div class="panel-body">
    <div id="thituyen">
        <div class="form-group">
            <h2 style="text-align:center; margin-bottom:5px">ĐĂNG KÝ HỒ SƠ THI TUYỂN</h2>
        </div>
        <div style="clear:both"></div>
        <div class="form-group">

            <div class="col-md-12">
                <div class="row"><label>1. Môn tùy chọn</label><i> (Môn tùy chọn trong 4 môn cơ bản thi)</i><label>:</label></div>
                <div class="col-lg-8 col-md-8">
                    <div class="row">
                        @Html.DropDownList("MaMon", (SelectList)ViewBag.MonTotNghiep, "Chọn Môn...", new { @class = "form-control form-shortcontrol valid", data_val = "true", data_val_required = " ", aria_required = "true", aria_describedby = "MaMon-error MaMon-error MaMon-error", id = "GraduateSubjectID" })
                        <span class="field-validation-valid" data-valmsg-for="MaMon" data-valmsg-replace="true"></span>
                        
                    </div>
                </div>
            </div>
        </div>
        <div style="clear:both"></div>
        <div class="form-group">
            <strong>2. Môn thi thêm:</strong><br />
            <div id="MonThiThem"></div>
        </div>
        <div style="clear:both"></div>
        <div class="form-group">
            <strong>3. Đăng ký dự thi : </strong><br />
            <div class="col-lg-6 col-md-6">
                <div class="col-lg-8 col-md-8">
                    <div class="row">
                        <strong>Khối thi: </strong>
                        @Html.DropDownList("MaKhoiThi", (SelectList)ViewBag.KhoiThi, "Chọn Khối thi...", new { @class = "form-control valid", data_val = "true", data_val_required = " ", aria_required = "true", aria_describedby = "MaKhoiThi-error MaKhoiThi-error MaKhoiThi-error", id = "GroupID1" })
                        <span class="field-validation-valid" data-valmsg-for="MaKhoiThi" data-valmsg-replace="true"></span>
                        <br />
                        <strong>Chuyên ngành : </strong>
                        @Html.DropDownListFor(m => m.MaChuyenNganh, new SelectList(Enumerable.Empty<SelectListItem>(), "MaChuyenNganh", "TenChuyenNganh"), "Chọn Chuyên ngành...", new { @class = "form-control", id = "MajorID1" })
                        @Html.ValidationMessageFor(model => model.MaChuyenNganh)
                    </div>
                </div>
            </div>
            <div class="col-lg-6 col-md-6">
                <div class="col-lg-8 col-md-8">
                    <div class="row">
                        <strong>Ngành : </strong>
                        @Html.DropDownList("MaNganh", new SelectList(Enumerable.Empty<SelectListItem>()), "Chọn Ngành...", new { @class = "form-control valid", id = "PhylumID1", data_val = "true", data_val_required = " ", aria_required = "true", aria_describedby = "MaNganh-error MaNganh-error MaNganh-error" })
                        <span class="field-validation-valid" data-valmsg-for="MaNganh" data-valmsg-replace="true"></span>
                        <br />
                        <div id="ddlChatLuongCao" style="visibility:hidden">
                            <strong>4. Tham gia Lớp đào tạo Chất lượng cao?</strong>
                            @Html.DropDownList("ChatLuongCao", ViewBag.ChatLuongCao as List<SelectListItem>, new { @class = "form-control" })
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var dulieu;
    $("form").removeData("validator");
    $("form").removeData("unobtrusiveValidation");
    $.validator.unobtrusive.parse("form");
    // University
    $(document).ready(function () {
        $("#GraduateSubjectID").change(function () {
            var graduatesubjectid = $(this).val();
            $("#MonThiThem").html('')
            $.getJSON("/Common/GetGraduateSubjectBySubjectCustom", { mamon: graduatesubjectid },
                   function (data) {
                       var select = $("#MonThiThem");
                       select.empty();
                       $.each(data, function (index, itemData) {
                           select.append('<input type="checkbox" name="checkbox" value="' + itemData.Value + '"/>  ' + itemData.Text + '<br/>');
                       });
                   });
        });
        // Step2_Examination
            $("#GroupID1").change(function () {
                $("#PhylumID1").html('').append($('<option/>', {
                    value: 0,
                    text: "Chọn Ngành..."
                }));
                
                var groupid = $(this).val();
                $.getJSON("/Common/GetPhylumByGroup", { TLID: $('#SendID').val(), makhoithi: groupid },
                        function (data) {
                            var select = $("#PhylumID1");
                            select.empty();
                            select.append($('<option/>', {
                                value: 0,
                                text: "Chọn Ngành..."
                            }));
                            $.each(data, function (index, itemData) {
                                select.append($('<option/>', {
                                    value: itemData.Value,
                                    text: itemData.Text
                                }));
                            });
                        });
            });
        $("#PhylumID1").change(function () {
            var phylumid = $(this).val();
            $("#MajorID1").html('').append($('<option/>', {
                value: 0,
                text: "Chọn Chuyên ngành..."
            }));
            $.getJSON("/Common/GetMajorByPhylum", { manganh: phylumid },
                   function (data) {
                       var select = $("#MajorID1");
                       select.empty();
                       select.append($('<option/>', {
                           value: 0,
                           text: "Chọn Chuyên ngành..."
                       }));
                       $.each(data, function (index, itemData) {
                           select.append($('<option/>', {
                               value: itemData.Value,
                               text: itemData.Text
                           }));
                       });
                   });
        });
        $("#MajorID1").change(function () {
            var url = "/Common/CheckMajor";
            var id = $(this).val();
            if (id.length > 0) {
                $.get(url, { major: id }, function (data) {
                    if (data == "True") {
                        $("#ddlChatLuongCao").css("visibility", "visible");
                    }
                    else {
                        $("#ddlChatLuongCao").css("visibility", "hidden");
                    }
                });
            }
        });
    });
</script>